{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication\Log\3_3_CMP_PRITM_Appendix_Average.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}29 Aug 2024, 15:42:46

{com}. do "C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication\Do\3_3_CMP_PRITM_Appendix_Average.do"
{txt}
{com}. *****************************************************************************
. * Cleaning and Analyzing - PRITM countries. Alternative proxy                           *
. *   . Polarization proxy as Average distance in all the party system        *
. *                                               Manifesto Project Database                          *
. *                                                                                                                                           *
. * Author:                       Valentina Gonzalez-Rostani                                                      *
. * Contact:                      mag384@pitt.edu                                                                 *
. * Date:                         March 21 2021                                                                           *
. * Version:                      Stata 17                                                                        *
. *                                                                                                                                                       *
. *****************************************************************************
. 
. /*
> This do-file:
>         A. Call the Data
>         B. Define variables
>         C. Export Tables 
> 
> Input: ** Manifesto Project database**
>         - Data\CMP\MPDataset_MPDS2020a_stata14.dta // Data download from https://manifesto-project.wzb.eu/datasets 2021
> 
> 
> Final output:
>         Cleaned data: 
>                 * "Data\CMP_average.dta" this data contains the relevant variables for the analysis with the DV as the polarization over redistribution, and fixed-value positions, estimated as the average distance of the party system.
>         Tables:
>                 * table A21: Partisan Polarization over Redistribution and Fixed Attributes
> 
> 
> */
. 
. cd "C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication" // Only change your directory
{res}C:\Users\vgonz\Dropbox\Pitt\OneDrive for Business\Dissertation - Vale\Paper 2 - Political-Economic Polarization\Replication
{txt}
{com}. 
. * Processing of the data (alternatively skip and go to line 158)
. {c -(}
. *##########################################
. * A. Calling the data
. *##########################################
. {c -(}
. 
. use "Data\CMP\MPDataset_MPDS2020a_stata14.dta", replace
{txt}(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
{com}. 
. {c )-}
. *############################################
. * B. Creating Variables
. *############################################
. {c -(}
. * YEAR
. gen year = year(edate) 
. 
. * Keep countries of interest
. keep if countryname=="Australia" |  countryname=="Canada" |  countryname=="Greece" |  countryname=="New Zealand" |  countryname=="Portugal" |  countryname=="Spain" |  countryname=="United Kingdom" |  countryname=="United States" |  countryname=="France" |  countryname=="Norway" | countryname=="Austria" | countryname=="Belgium" | countryname=="Denmark" | countryname=="Estonia" | countryname=="Finland" | countryname=="Hungary" | countryname=="Germany" | countryname=="Iceland"  | countryname=="Ireland"  | countryname=="Italy"  | countryname=="Netherlands"  | countryname=="Norway" | countryname=="Slovakia" | countryname=="Slovenia" | countryname=="Sweden" | countryname=="Switzerland"
{txt}(1,682 observations deleted)
{com}. 
. * Defines a dummy to identify PRITM countries
. gen PRITM=. 
{txt}(2,900 missing values generated)
{com}. replace PRITM=0 if countryname=="Australia"
{txt}(111 real changes made)
{com}. replace PRITM=0 if countryname=="Canada"
{txt}(94 real changes made)
{com}. replace PRITM=0 if countryname=="Greece"
{txt}(84 real changes made)
{com}. replace PRITM=0 if countryname=="New Zealand"
{txt}(101 real changes made)
{com}. replace PRITM=0 if countryname=="Portugal"
{txt}(101 real changes made)
{com}. replace PRITM=0 if countryname=="Spain"
{txt}(157 real changes made)
{com}. replace PRITM=0 if countryname=="United Kingdom"
{txt}(98 real changes made)
{com}. replace PRITM=0 if countryname=="United States"
{txt}(53 real changes made)
{com}. replace PRITM=0 if countryname=="France"
{txt}(116 real changes made)
{com}. 
. replace PRITM=1 if countryname=="Austria"
{txt}(83 real changes made)
{com}. replace PRITM=1 if countryname=="Belgium"
{txt}(184 real changes made)
{com}. replace PRITM=1 if countryname=="Denmark"
{txt}(235 real changes made)
{com}. replace PRITM=1 if countryname=="Estonia"
{txt}(47 real changes made)
{com}. replace PRITM=1 if countryname=="Finland"
{txt}(162 real changes made)
{com}. replace PRITM=1 if countryname=="Germany"
{txt}(89 real changes made)
{com}. replace PRITM=1 if countryname=="Hungary"
{txt}(43 real changes made)
{com}. replace PRITM=1 if countryname=="Iceland"
{txt}(117 real changes made)
{com}. replace PRITM=1 if countryname=="Ireland"
{txt}(103 real changes made)
{com}. replace PRITM=1 if countryname=="Italy"
{txt}(178 real changes made)
{com}. replace PRITM=1 if countryname=="Netherlands"
{txt}(178 real changes made)
{com}. replace PRITM=1 if countryname=="Norway"
{txt}(130 real changes made)
{com}. replace PRITM=1 if countryname=="Slovenia"
{txt}(72 real changes made)
{com}. replace PRITM=1 if countryname=="Slovakia"
{txt}(69 real changes made)
{com}. replace PRITM=1 if countryname=="Sweden"
{txt}(137 real changes made)
{com}. replace PRITM=1 if countryname=="Switzerland"
{txt}(158 real changes made)
{com}. 
. 
. * CONTROL VARIABLES - number of parties
. 
. gen number = 1
. egen number2= sum(number), by(edate)
. lab var number2 "Number of parties"
. 
. *############################################################
. * DEPENDENT VARIABLE Redistribution and Fixed Attributes
. *############################################################
. {c -(}
. * Obtaining relevant policy variables
. 
. gen welfare_policy =  ln(per504+0.5) - ln(per505+0.5)
{txt}(7 missing values generated)
{com}. 
. gen fixed = .
{txt}(2,900 missing values generated)
{com}. replace fixed = (ln(per107+per108+per407+per602+0.5+per602_2)-ln(per109+per110+per406+per601+0.5+per601_2)) if !missing(per602_2) & !missing(per601_2)
{txt}(333 real changes made)
{com}. replace fixed = (ln(per107+per108+per407+per602+0.5)-ln(per109+per110+per406+per601+0.5)) if missing(per602_2) | missing(per601_2)
{txt}(2,560 real changes made)
{com}. 
. {c )-}
. 
. ** Different code compared to 3_2 do file: 
. ***** Now average distance instead of distance between certain party families
. {c -(}
. egen av_welfare_policy= mean(welfare_policy), by(edate countryname)
. gen dist_av_welfare_policy = abs(welfare_policy-av_welfare_policy)
{txt}(7 missing values generated)
{com}. 
. egen av_fixed= mean(fixed), by(edate countryname)
. gen dist_av_fixed = abs(fixed-av_fixed)
{txt}(7 missing values generated)
{com}. 
. {c )-}
. * Collapsing the data 
. {c -(}
. collapse (sum) av_welfare_policy dist_av_welfare_policy   av_fixed dist_av_fixed  (first) year  PRITM  totseats number2 oecdmember date  , by(edate countryname)
{res}{com}. {c )-}
. // Final Prep of the data
. {c -(}
. egen country_number = group(countryname)
. sort country_number edate
. bysort country_number: gen election_order=_n
. xtset country_number election_order
{res}
{col 1}{txt:Panel variable: }{res:country_number}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:election_order}{txt:, }{res:{bind:1}}{txt: to }{res:{bind:28}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{com}. sort countryname  election_order
. sort countryname  year
. 
. gen shock=.
{txt}(474 missing values generated)
{com}. replace shock =0 if year > 1969 & year < 1995
{txt}(166 real changes made)
{com}. replace shock =1 if  year > 1994
{txt}(167 real changes made)
{com}. xtset country_number election_order
{res}
{col 1}{txt:Panel variable: }{res:country_number}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:election_order}{txt:, }{res:{bind:1}}{txt: to }{res:{bind:28}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{com}. {c )-}
. {c )-}
. *############################################
. * Saving the data
. *############################################
. {c -(}
. 
. lab var PRITM "PR with Trichotomous Multipartism"
. lab var totseats "Total Number of Seats"
. lab var number2 "Total Number of Parties"
. lab var oecdmember "OECD member"
. lab var PRITM "PRITM"
. 
. lab var dist_av_welfare_policy "Distance Redistribution (DR) - Net Welfare"
. lab var dist_av_fixed "Distance Fixed-Value Positions (DFVP) - Net Anti-Global"
. 
. lab var shock "High LMP period" // post 1994
. 
. keep  PRITM year  countryname  oecdmember totseats shock dist_av_welfare_policy dist_av_fixed   number2 election_order country_number
. 
. keep if year>1969
{txt}(141 observations deleted)
{com}. keep if PRITM==1
{txt}(131 observations deleted)
{com}. 
. save "Data\CMP_average.dta", replace
{txt}{p 0 4 2}
file {bf}
Data\CMP_average.dta{rm}
saved
{p_end}
{com}. 
. {c )-}
. {c )-}
{txt}
{com}. * Alternatively load prepared data
. {c -(}
. use "Data\CMP_average.dta", clear       
{txt}(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
{com}. {c )-}
{txt}
{com}. *##########################################
. * Analysis
. *##########################################
. // table A21: Partisan Polarization over Redistribution and Fixed Attributes
. {c -(}
. 
. preserve
.  
. eststo clear
. eststo: qui reg dist_av_welfare_policy L.dist_av_welfare_policy shock totseats  oecdmember  number2 i.year, cluster(countryname)
{txt}({res}est1{txt} stored)
{com}. eststo: qui reg dist_av_fixed L.dist_av_fixed shock totseats  oecdmember  number2 i.year, cluster(countryname)
{txt}({res}est2{txt} stored)
{com}. 
. esttab , replace label se title(Partisan Polarization over Redistribution and Fixed Attributes  \label {c -(}TabWithinpoldistav{c )-}) mti("Redistribution" "Fixed Values" "Redistribution" "Fixed Values" ) compress nogap star(* 0.1 ** 0.05 *** 0.01) b(%6.3f) keep(shock  ) scalars( "N Observations" "r2 R$^2$" "aic AIC" ) indicate("Controls = tots*" "LDV = L.*" "FE Year = *year") 
{res}
{txt}Partisan Polarization over Redistribution and Fixed Attributes \label {TabWithinpoldistav}
{txt}{hline 42}
{txt}                       (1)          (2)   
{txt}                 Redistr~n    Fixed V~s   
{txt}{hline 42}
{txt}High LMP period {res}    -1.505        3.399***{txt}
                {res} {ralign 9:{txt:(}1.933{txt:)}}    {ralign 9:{txt:(}1.011{txt:)}}   {txt}
{txt}Controls        {res}       Yes          Yes   {txt}
{txt}LDV             {res}       Yes          Yes   {txt}
{txt}FE Year         {res}       Yes          Yes   {txt}
{txt}{hline 42}
{txt}Observations    {res}       186          186   {txt}
{txt}R$^2$           {res}     0.631        0.705   {txt}
{txt}AIC             {res}   899.206      889.795   {txt}
{txt}{hline 42}
{txt}Standard errors in parentheses
{txt}* p<0.1, ** p<0.05, *** p<0.01
{com}. 
. esttab using "Table\Tab_Within_d_av.tex", replace label se title(Partisan Polarization over Redistribution and Fixed Attributes  \label {c -(}TabWithinpoldistav{c )-}) mti("Redistribution" "Fixed Values" "Redistribution" "Fixed Values" ) compress nogap star(* 0.1 ** 0.05 *** 0.01) b(%6.3f) keep(shock  ) scalars( "N Observations" "r2 R$^2$" "aic AIC" ) indicate("Controls = tots*" "LDV = L.*" "FE Year = *year") 
{res}{txt}(output written to {browse  `"Table\Tab_Within_d_av.tex"'})
{com}. 
. 
. 
. restore
. 
. {c )-}
{txt}
{com}. 
{txt}end of do-file

{com}. exit, clear
